<!-- 教学管理-课程安排-课程考勤统计 -->
<template>
  <div class="JNPF-common-layout">
    <div class="JNPF-common-layout-center">
      <el-row class="JNPF-common-search-box" :gutter="16">
        <el-form @submit.native.prevent>

          <el-col :span="8">
            <el-form-item label="日期">
              <el-date-picker v-model="fbillcredate" type="daterange" value-format="yyyy-MM-dd" range-separator="至"
                start-placeholder="开始日期" end-placeholder="结束日期">
              </el-date-picker>
            </el-form-item>
          </el-col>

          <el-col :span="6">
            <el-form-item label="对象类型">
              <el-select v-model="listQuery.fcustomno" placeholder="请选择"
                :disabled="$store.getters.userInfo.manufacturer">
                <el-option
                  v-for="item in options1"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>

          <template v-if="showAll">
            <el-col :span="6">
            <el-form-item label="所属校区">
              <el-select v-model="listQuery.fcustomno" placeholder="请选择"
                :disabled="$store.getters.userInfo.manufacturer">
                <el-option
                  v-for="item in options5"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>

            <el-col :span="6">
            <el-form-item label="学院名称">
              <el-select v-model="listQuery.fcustomno" placeholder="请选择"
                :disabled="$store.getters.userInfo.manufacturer">
                <el-option
                  v-for="item in options3"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>

          <el-col :span="6">
            <el-form-item label="专业名称">
              <el-select v-model="listQuery.fcustomno" placeholder="请选择"
                :disabled="$store.getters.userInfo.manufacturer">
                <el-option
                  v-for="item in options4"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>

          <el-col :span="6">
            <el-form-item label="班级名称">
              <el-input v-model="listQuery.fclass" placeholder="班级名称" clearable />
            </el-form-item>
          </el-col>

          <el-col :span="6">
            <el-form-item label="对象名称">
              <el-input v-model="listQuery.fbillname" placeholder="对象名称" clearable />
            </el-form-item>
          </el-col>

        </template>

          <el-col :span="6">
            <el-form-item label="">
              <el-button type="primary" icon="el-icon-search" >查询</el-button>
              <el-button type="danger" icon="el-icon-download">导出</el-button>
              <!-- <el-button type="primary" icon="el-icon-plus" @click="insert(undefined)">新增</el-button> -->
              <el-button type="text" icon="el-icon-arrow-down" @click="showAll = true" v-if="!showAll">展开</el-button>
              <el-button type="text" icon="el-icon-arrow-up" @click="showAll = false" v-else>收起</el-button>
            </el-form-item>
          </el-col>
        </el-form>
      </el-row>
      <div class="JNPF-common-layout-main JNPF-flex-main">
        <JNPF-table :data="list" border v-loading="loading">
          <el-table-column prop="FHOME" label="所属校区" ></el-table-column>
          <el-table-column prop="FBILLNAME" label="对象类型"></el-table-column>
          <el-table-column prop="FBILLNO" label="对象名称"></el-table-column>
          <el-table-column prop="F1" label="正常"></el-table-column>
          <el-table-column prop="F2" label="迟到早退"></el-table-column>
          <el-table-column prop="F3" label="请假"></el-table-column>
          <el-table-column prop="F4" label="缺勤"></el-table-column>
          <el-table-column fixed="left" label="操作" align="center" width="100">
            <template slot-scope="scope">
              <el-button type="text" @click="insert(scope.row.FBILLNO)" size="small" icon="el-icon-edit">
                查看详情
              </el-button>
            </template>
          </el-table-column>
        </JNPF-table>
        <pagination :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit"/>
        <Form ref="Form"  :formationlist="customlist" />
      </div>
    </div>
  </div>
</template>
<script>
  import Form from "./Form.vue"
  import jnpf from "@/utils/jnpf"
  export default {
    name: 'shop',
    components: { Form },
    data() {
      return {
        showAll: false,

        //所属校区选择数据
        options1: [{
          value: 'L001',
          label: '全部'
        }, {
          value: 'L002',
          label: '教师'
        }, {
          value: 'L003',
          label: '学生'
        }],

        options3: [{
          value: 'L001',
          label: '化学与材料科学学院'
        }, {
          value: 'L002',
          label: '生命科学学院'
        }],

        options4: [{
          value: 'L001',
          label: '化学系'
        }, {
          value: 'L002',
          label: '化工与材料系'
        }, {
          value: 'L003',
          label: '分析测试中心'
        }, {
          value: 'L004',
          label: '生物科学'
        }],

        options5: [{
          value: '10',
          label: '徐汇桂林路校区'
        }, {
          value: '20',
          label: '奉贤海湾校区'
        }],

        
        customlist:[
          {
            "FHOME":"奉贤海湾校区",
            "FBILLNAME": "教师",
            "FBILLNO": "汉武帝",
            "F1": "10",
            "F2": "0",
            "F3": "0",
            "F4": "0",
            "FMEMO": ""
          },
        ],
        list: [
            {
            "FHOME":"奉贤海湾校区",
            "FBILLNAME": "教师",
            "FBILLNO": "汉武帝",
            "F1": "10",
            "F2": "0",
            "F3": "0",
            "F4": "0",
            "FMEMO": ""
            },{
            "FHOME":"奉贤海湾校区",
            "FBILLNAME": "学生",
            "FBILLNO": "曹操",
            "F1": "8",
            "F2": "1",
            "F3": "0",
            "F4": "1",
            "FMEMO": ""
            },
            ,{
            "FHOME":"奉贤海湾校区",
            "FBILLNAME": "学生",
            "FBILLNO": "刘备",
            "F1": "9",
            "F2": "0",
            "F3": "1",
            "F4": "0",
            "FMEMO": ""
            },{
            "FHOME":"奉贤海湾校区",
            "FBILLNAME": "学生",
            "FBILLNO": "关羽",
            "F1": "9",
            "F2": "1",
            "F3": "0",
            "F4": "0",
            "FMEMO": ""
            },
        ],
        fbillcredate: [jnpf.dateFormat(new Date(), "YYYY-MM-DD"), jnpf.dateFormat(new Date(), "YYYY-MM-DD")],
        loading: false,
        total: 0,
        listQuery: {
          page: 1,
          limit: 20,
          sort: "desc",
          sidx: "",
          fbillstate: "",
          fbillno: "",
          begindate: undefined,
          enddate: undefined,
          fcustomno: ""
        },
      };
    },
    computed: {},
    methods: {
      insert(id) {
        this.$refs.Form.init(id);
      },
    },
  };
</script>